<?php

namespace App\Http\Rules\Auth;

use App\Http\Rules\Validate;
use Illuminate\Contracts\Validation\Rule;

class AuthValidate extends Validate implements Rule
{
    protected $rule = [
        "email" => 'required',
        'wxCode' => 'required',
        'openid' => '',
        'phone' => 'required|min:11|max:11|regex:/^1[3456789]\d{9}$/',
        'smsCode' => 'required|size:4',
        'password' => 'required|string|between:6,20',
        'nickname' => 'sometimes|string|between:2,20',
        'gender' => 'required|in:1,2',
        'birthday' => 'required',
        'avatar' => 'required|url',
        'lifeStatus' => 'required|integer',
        'constellation' => 'required',
        'mbti' => 'required',
        'introduce' => 'required',
        'school' => 'required',
        'profession' => 'required',
        'company' => 'required',
        'provinceId' => 'required',
        'cityId' => 'required',
        'areaId' => 'required',
        'streetId' => 'required',
        'isAgreement' => 'required',
        'lng' => 'required',
        'lat' => 'required',
        'addressHide' => 'required',
        'userPhotos' => 'array',
        'userLabel' => 'array',
        'userTopic' => 'array',
        'UserCharacter' => 'array',
        'clientId' => 'required',
        'channel' => 'required',
    ];

    protected $scene = [
        'register' => [
            'email', 'smsCode'
        ],
        'bindPhone' => [
            'phone', 'smsCode'
        ],
        'bindClient' => [
            'clientId','channel'
        ],
        'login' => [
            'account', "password"
        ],
        'wxCode' => [
            'wxCode'
        ],
        'resetPassword' => [
            'phone', "password", "smsCode"
        ],
        'modify' => [
//            'openid', 'nickname', 'gender', 'birthday', 'avatar', 'lifeStatus', 'constellation', 'mbti', 'introduce',
//            'provinceId', 'cityId', 'areaId', 'streetId', 'isAgreement', 'lng', 'lat', 'addressHide', 'userPhotos', 'userLabel', 'userTopic'
        ]
    ];

    protected $message = [
    ];


    /**
     * Create a new rule instance.
     *
     * @return void
     */
    public function __construct()
    {
        //
    }

    /**
     * Determine if the validation rule passes.
     *
     * @param string $attribute
     * @param mixed $value
     * @return bool
     */
    public function passes($attribute, $value)
    {
        //
    }

    /**
     * Get the validation error message.
     *
     * @return string
     */
    public function message()
    {
        return 'The validation error message.';
    }
}
